import { Component, OnInit, Input } from "@angular/core";
import { AppGlobalService } from "src/app/shared/service/app-global.service";
import { ModalController } from "@ionic/angular";

@Component({
  selector: "app-service-module",
  templateUrl: "./service-module.component.html",
  styleUrls: ["./service-module.component.scss"],
})
export class ServiceModuleComponent implements OnInit {
  constructor(
    private appGlobalService: AppGlobalService,
    public modalController: ModalController
  ) {}
  @Input() tagData: any;

  showList = [];

  ngOnInit() {
    this.showList = this.tagData.modelList;
  }

  async handleClick(item) {
    const sessionId = localStorage.getItem("sessionId");
    const pageParams = {
      pageId: item.target,
      params: item.params,
      sessionId,
    };
    await this.modalController.dismiss({ dismissed: true });
    await this.appGlobalService.goToForward(pageParams);
  }
}
